package com.example.demo.services.ServerImpl;

import com.example.demo.domain.Carousel;
import com.example.demo.domain.CarouselRepository;
import com.example.demo.services.CarouselServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CarouselServerImpl implements CarouselServer {
    @Autowired
    CarouselRepository carouselRepository;


    @Override
    public List<Carousel> selectAll() {

        return carouselRepository.findAll();

    }

    @Override
    public void insertCarousel(Carousel carousel) {
        carouselRepository.save(carousel);
    }

    @Override
    public void deleteAll() {
        carouselRepository.deleteAll();
    }

    @Override
    public List<Map<String,Object>> fieldAll() {
        return carouselRepository.getCustomField();
    }


}
